//
// Created by 小演员的MacBook on 2024/7/2.
//

#include <iostream>
#include <utility>
using namespace std;

class Circle {
public:
    int radius;
    double calculateLength() {
        return 2 * 3.14 * radius;
    }
};

class Student {//默认private
    string name;

public:
    void setName(string n) {
//        name = n;
        name = std::move(n);
    }
    string getName() {
        return name;
    }
};

struct Person {//默认public
private:
    string name;
    void setName(string n) {
        name = n;
    }
    string getName() {
        return name;
    }
};

class Teacher {
public:
    int age;
public:
    Teacher() {//构造函数
        cout << "Teacher()" << endl;
    }
    Teacher(int age) {
        this->age = age;
        cout << "Teacher(int age)" << endl;
    }
    ~Teacher() {//析构函数
        cout << age << endl;
        cout << "~Teacher()" << endl;
    }
};

int main() {

    // 创建对象；实例化对象（通过一个类 创建一个对象的过程）
    Circle circle;
    circle.radius = 5;
    cout << "圆的周长为：" << circle.calculateLength() << endl;

    Student student;
    student.setName("zhang");
    cout << "学生姓名为：" << student.getName() << endl;

    Teacher teacher = Teacher();
    teacher = Teacher(20);
    Teacher teacher2 = Teacher(30);
    Teacher t(40);
    Teacher t1 = 10;
    cout << &teacher << endl;
    cout << teacher.age << endl;
    return 0;
}
